#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 7;
int n, t[N], mx;

int main(){
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n; i++){
        int x;
        cin >> x;
        t[x]++;
        mx = max(mx, x);
    }
    for (int i = 2; i <= mx; i++) t[i] = max(t[i-1], t[i]);
    cout << t[mx];
    return 0;
}
